---
title: Change type
description: A change type operation changes the type of a column.
---

## Structure

<YamlJsonTabs>
```yaml
alter_column:
  table: table name
  column: column name
  type: new type of column
  up: SQL expression
  down: SQL expression
```
```json
{
  "alter_column": {
    "table": "table name",
    "column": "column name",
    "type": "new type of column",
    "up": "SQL expression",
    "down": "SQL expression"
  }
}
```
</YamlJsonTabs>

Use the `up` SQL expression to do data conversion from the old column type to the new type. In the old schema version, the column will have its old data type; in the new version the column will have its new type.

Use the `down` SQL expression to do data conversion in the other direction; from the new data type back to the old.

## Examples

### Change column type

Change the type of the `rating` column on the `reviews` table:

<ExampleSnippet example="18_change_column_type.yaml" languange="yaml" />
